﻿using System.Web.Mvc;
using System.Web.Mvc.Html;

namespace Omu.Awesome.Mvc.Helpers
{
    public static class ConfirmHelpers
    {
        public static MvcHtmlString Confirm(this HtmlHelper helper, string message, string cssClass = "confirm", string title = null, int? height = null, int? width = null, string yesText = null, string noText = null)
        {
            if (Settings.GetText != null)
            {
                if (yesText == null) yesText = Settings.GetText("Confirm", "Yes");
                if (noText == null) noText = Settings.GetText("Confirm", "No");
                if (title == null) title = Settings.GetText("Confirm", "Title");
            }
            return helper.Partial(Settings.AwesomeFolder + "Confirm.ascx",
                new ConfirmInfo
                    {
                        Message = message,
                        CssClass = cssClass,
                        Height = height ?? Settings.Confirm.Height,
                        Width = width ?? Settings.Confirm.Width,
                        YesText = yesText ?? Settings.Confirm.YesText,
                        NoText = noText ?? Settings.Confirm.NoText,
                        Title = title ?? Settings.Confirm.Title
                    });
        }
    }
}